<div class="row-fluid">
    <div class="span12">                    
        <div class="head">
            <div class="isw-grid"></div>
            <h1><?php echo $this->pageTitle;?></h1>
			<a href="<?php echo PIUrl::createUrl('/admincp/product/create');?>" class="btn btn-success btn-addSlide" type="button" style="float:right;margin:4px;">Thêm mới Sản phẩm</a>
            <div class="clear"></div>
        </div>
        <div class="block-fluid table-sorting">
		<div id="tSortable_wrapper" class="dataTables_wrapper" role="grid">
			<div class="dataTables_filter" id="tSortable_filter" style="float:left;width: 100%;">
			<form action="" method="GET">
				<label>Tìm kiếm theo tên: <input style="width:300px" type="text"  name="name" value="<?php if(isset($_GET['name'])) echo $_GET['name']?>"></label>
			</form>
			</div>
            
			<table cellpadding="0" cellspacing="0" width="100%" class="table dataTable">
                <thead>
                    <tr>                                    
                        <th style="text-align:center" width="5%">STT</th>
                        <th style="text-align:center" width="10%">Hình ảnh</th>
                        <th width="25%">Tên sản phẩm</th>
                        <th width="15%">Đơn giá (VNĐ)</th>
                        <th width="20%">Danh mục</th>
                        <th width="10%">Ngày tạo</th>
                        <th style="text-align:center" width="15%">Chức năng</th>                                    
                    </tr>
                </thead>
                <tbody>
				<?php $i=1; if(!empty($model)) foreach($model as $item):?>
                    <tr>                                    
                        <td style="text-align:center"><?php echo $i;?></td>
                        <td style="text-align:center"><a class="fancybox" rel="group" href="<?php echo Yii::app()->baseUrl;?>/upload/products/<?php echo $item->image;?>"><img src="<?php echo Yii::app()->baseUrl.'/upload/image.php?width=50&image='.Yii::app()->baseUrl.'/upload/products/'.$item->image;?>" width="50" class="img-polaroid"></a></td>
                        <td><?php echo $item->name;?></td>
                        <td><?php echo number_format($item->price);?></td>
                        <td><?php echo $item->Categories->name;?></td>
                        <td><?php echo date('d-m-Y',$item->created);?></td>
                        <td style="text-align:center">
                            <a href="<?php echo PIUrl::createUrl('/admincp/product/update/id/'.$item->id);?>" class="btn btn-mini btn-updateCat" type="button">Cập nhật</a>
                            <a href="<?php echo PIUrl::createUrl('/admincp/product/delete/id/'.$item->id);?>" onclick="return confirm('Bạn thực sự muốn xóa?')" class="btn btn-mini btn-warning" type="button">Xóa</a>
					</td>
                    </tr>
				<?php $i++; endforeach;?>
                </tbody>
            </table>
			<div class="dataTables_paginate paging_full_numbers" id="tSortable_2_paginate">
			<?php //dump($this->widget('CLinkPager'));?>
				<?php $this->widget('CLinkPager', array(
					'pages' => $pages,
					'header'=>'',
					'nextPageLabel'=>'Sau &gt;',
					'prevPageLabel'=>'&lt; Trước',
					'firstPageLabel'=>'&lt;&lt; Đầu',
					'lastPageLabel'=>'Cuối &gt;&gt;'
				)) ?>
			</div>
			</div>
			<div class="clear"></div>
        </div>
    </div>                                
</div>